import java.util.List;

public class iuvb {
    package com.example.demo.mapper;

import com.example.demo.UserInfo;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

    @Mapper
    public interface UserInfoMapper {
        @Select("select username, `password`, age, gender, phone from userinfo")
        //public List<UserInfo> queryAllUser();
        @Select("select username, `password`, age, gender, phone from userinfo where id= #{userid} ")
        UserInfo queryById(@Param("userid") Integer id);

        //@Insert("insert into userinfo (username, `password`, age, gender, phone) values (#{userinfo.username},#{userinfo.password},#{userinfo.age},# {userinfo.gender},#{userinfo.phone})")
        //Integer insert(@Param("userinfo") UserInfo userInfo);

        @Options(useGeneratedKeys = true, keyProperty = "id")
        @Insert("insert into userinfo (username, age, gender, phone) values (# {userinfo.username},#{userinfo.age},#{userinfo.gender},#{userinfo.phone})")
        Integer insert( UserInfo userInfo);

        @Delete("delete from userinfo where id = #{id}")
        void delete(Integer id);
        @Update("update userinfo set username=#{username} where id=#{id}")
        void update(UserInfo userInfo);
        @Select("select id, username, `password`, age, gender, phone, delete_flag, create_time, update_time from userinfo")
        List<UserInfo> queryAllUser();
    }

}
